package fr.afcepf.atodcp2.benbai.dao.implementations;



import java.util.ArrayList;
import java.util.List;
import fr.afcepf.atodcp2.benbai.dao.generique.GenericDaoHibernateTemplateImpl;
import fr.afcepf.atodcp2.benbai.dao.interfaces.IDaoClient;
import fr.afcepf.atodcp2.benbai.entity.Authentification;
import fr.afcepf.atodcp2.benbai.entity.Client;



public class DaoClient extends GenericDaoHibernateTemplateImpl<Client, Integer> implements IDaoClient {

		
	@Override
	public Client getClientByAuthentification(Authentification authentification) {
		String param = "paramIdAuthentification";
		Object value = authentification.getIdLogin();		
		@SuppressWarnings("unchecked")
		List<Client> result = hibernateTemplate.findByNamedParam("FROM Client c WHERE c.authentification.idLogin like :paramIdAuthentification", param, value);
		Client client = result.get(0);		
		return client;
	}
	
	

		

}
